/**
 * @param {number[]} nums
 * @param {number} target
 * @return {number[]}
 * @description 双指针
 */

var twoSum = function (nums, target) {
    let start = 0
    let len = nums.length
    let end = len - 1
    while (start < end) {
        if (nums[start] + nums[end] < target) {
            start++
        } else if (nums[start] + nums[end] > target) {
            end--
        } else {
            return [nums[start],nums[end]]
        }
    }
    return []
};